Skip to content

macOS: move from objc and cocoa crates to the objc2 crates#240

Merged
prokopyl merged 16 commits into
masterfrom
obcj2
May 14, 2026
Merged

macOS: move from objc and cocoa crates to the objc2 crates#240
prokopyl merged 16 commits into
masterfrom
obcj2

Conversation

@prokopyl
Copy link
Copy Markdown
Member

@prokopyl prokopyl commented May 4, 2026

This PR removes the cocoa, core_foundation and objc crates as dependencies, and replaces them with the objc2 family of crates.

On top of removing outdated dependencies and bringing us closer to the rest of the ecosystem, objc2 brings a couple benefits:

  • Proper types throughout the codebase. objc exposed a lot of things as just id, and didn't manage null nor proper object retention at all.
  • Way fewer instances of unsafe. objc2 provides simple safe wrappers for a lot of the simple operations.

The goal of this PR is to update the invocations while changing as little logic as possible. Further refactorings and code cleanups are needed, but will come in later releases.

I have tested those changes successfully on macOS 26.2. More testing is always welcome however. 🙂

Comment thread src/macos/window.rs Outdated
Comment thread src/macos/window.rs Outdated
Comment thread src/macos/view.rs Outdated
@prokopyl prokopyl marked this pull request as draft May 4, 2026 20:21
@prokopyl prokopyl marked this pull request as ready for review May 5, 2026 10:30
@prokopyl prokopyl requested a review from micahrj May 5, 2026 10:30
@prokopyl prokopyl added this to the v0.1.1 - Updated foundations milestone May 5, 2026
Comment thread Cargo.toml
Comment thread src/gl/macos.rs Outdated
Comment thread src/macos/window.rs
Comment thread src/macos/view.rs Outdated
Comment thread src/macos/view.rs Outdated
prokopyl and others added 2 commits May 14, 2026 15:37
Co-authored-by: Micah Johnston <micahrjohnston@gmail.com>
@prokopyl prokopyl requested a review from micahrj May 14, 2026 14:03
Comment thread src/macos/view.rs Outdated
Co-authored-by: Micah Johnston <micahrjohnston@gmail.com>
@prokopyl prokopyl merged commit 29e2899 into master May 14, 2026
6 checks passed
@prokopyl prokopyl deleted the obcj2 branch May 14, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants